import {defineStore} from "pinia";
import {
    SET_CHAT_MESSAGE_EVENT, SET_COLLECT_MESSAGE,
    SET_COMMENT_LIST, SET_COMMENT_MESSAGE,
    SET_COMMENT_REPORT_DICT,
    SET_CREATE_PROBLEM_MESSAGE,
    SET_CREATE_QUESTION_MESSAGE,
    SET_DOMAIN_EVENT_MESSAGE,
    SET_MOMENT_LIST,
    SET_MOMENT_TOPIC_LIST,
    SET_NOTICE_TYPE, SET_PAY_SUCCESS,
    SET_PRAISE_MESSAGE,
    SET_SIGN_IN_MESSAGE, SET_TASK_FINISH
} from "@/store/user/mutationTypes";

// 全局事件状态管理
export const useSysEventStore = defineStore({
    id: 'sysEvent',
    state: () => ({
        // 评论列表
        commentList: [],
        // 动态列表
        momentList: [],
        // 创建问答消息，用于控制问答弹框
        createQuestionMessage: "",
        // 创建面经消息，用于控制发表面经弹出框
        createProblemMessage: "",
        // 通知类型
        noticeType: "",
        // 评论举报类型字典
        commentReportDict: {},
        // 话题列表
        momentTopicList: [],
        // 签到消息，用于签到刷新
        signInMessage: "",
        // 聊天消息事件，用于触发@操作、引用等操作
        chatMessageEvent: {},
        domainEventMessage: {}, // 领域事件消息
        taskFinishMessage: "", // 任务完成消息
        paySuccessMessage: "", // 支付成功消息
        praiseMessage: "", // 点赞消息
        collectMessage: "", //收藏事件消息
        commentMessage: ""
    }),
    getters: {},
    actions: {
        // 设置评论列表
        [SET_COMMENT_LIST](commentList: any) {
            this.commentList = commentList
        },
        // 设置动态列表
        [SET_MOMENT_LIST](momentList: any) {
            this.momentList = momentList
        },
        // 设置问答消息
        [SET_CREATE_QUESTION_MESSAGE](createQuestionMessage: any) {
            this.createQuestionMessage = createQuestionMessage
        },
        // 设置创建问题消息
        [SET_CREATE_PROBLEM_MESSAGE](createProblemMessage: any) {
            this.createProblemMessage = createProblemMessage
        },
        // 设置个人中心消息
        [SET_DOMAIN_EVENT_MESSAGE](domainEventMessage: any) {
            this.domainEventMessage = domainEventMessage
        },
        // 设置通知消息
        [SET_NOTICE_TYPE](noticeType: any) {
            this.noticeType = noticeType
        },
        // 设置评论举报类型字典
        [SET_COMMENT_REPORT_DICT](commentReportDict: any) {
            this.commentReportDict = commentReportDict
        },
        // 设置话题列表
        [SET_MOMENT_TOPIC_LIST](momentTopicList: any) {
            this.momentTopicList = momentTopicList
        },
        // 设置消息
        [SET_SIGN_IN_MESSAGE](signInMessage: any) {
            this.signInMessage = signInMessage
        },
        // 设置聊天消息事件
        [SET_CHAT_MESSAGE_EVENT](chatMessageEvent: any) {
            this.chatMessageEvent = chatMessageEvent
        },
        // 设置任务完成消息事件
        [SET_TASK_FINISH](taskFinishMessage: any) {
            this.taskFinishMessage = taskFinishMessage
        },
        // 设置支付完成消息事件
        [SET_PAY_SUCCESS](paySuccessMessage: any) {
            this.paySuccessMessage = paySuccessMessage
        },
        // 设置点赞消息
        [SET_PRAISE_MESSAGE](setPraiseMessage: any) {
            this.praiseMessage = setPraiseMessage
        },
        // 设置收藏消息
        [SET_COLLECT_MESSAGE](setCollectMessage:any){
            this.collectMessage = setCollectMessage
        },
        [SET_COMMENT_MESSAGE](setCommentMessage:any){
            this.commentMessage = setCommentMessage
        }
    }
})
